home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / cc / dist / gvarargs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-21  |  1.3 KB  |  65 lines

  1. #ifndef __GNUC__
  2. /* Use the system's macros with the system's compiler.  */
  3. #include <varargs.h>
  4. #else
  5. #ifdef __spur__
  6. #include "va-spur.h"
  7. #else
  8. #ifdef __mips__
  9. #include "va-mips.h"
  10. #else
  11. #ifdef __i860__
  12. #include "va-i860.h"
  13. #else
  14. #ifdef __pyr__
  15. #include "va-pyr.h"
  16. #else
  17.  
  18. #ifdef __NeXT__
  19.  
  20. /* On Next, erase any vestiges of stdarg.h.  */
  21.  
  22. #undef va_alist
  23. #undef va_dcl
  24. #undef va_list
  25. #undef va_start
  26. #undef va_end
  27. #undef __va_rounded_size
  28. #undef va_arg
  29.  
  30. /* Record that varargs.h is defined; this turns off stdarg.h.  */
  31.  
  32. #ifndef _VARARGS_H
  33. #define _VARARGS_H
  34. #endif
  35. #endif  /* __NeXT__ */
  36.  
  37. /* These macros implement traditional (non-ANSI) varargs
  38.    for GNU C.  */
  39.  
  40. #define va_alist  __builtin_va_alist
  41. #define va_dcl    int __builtin_va_alist;
  42. #define va_list   char *
  43.  
  44. #ifdef __sparc__
  45. #define va_start(AP)                         \
  46.  (__builtin_saveregs (),                    \
  47.   AP = ((void *) &__builtin_va_alist))
  48. #else
  49. #define va_start(AP)  AP=(char *) &__builtin_va_alist
  50. #endif
  51. #define va_end(AP)
  52.  
  53. #define __va_rounded_size(TYPE)  \
  54.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  55.  
  56. #define va_arg(AP, TYPE)                        \
  57.  (AP += __va_rounded_size (TYPE),                    \
  58.   *((TYPE *) (AP - __va_rounded_size (TYPE))))
  59.  
  60. #endif /* not pyr */
  61. #endif /* not i860 */
  62. #endif /* not mips */
  63. #endif /* not spur */
  64. #endif /* __GNUC__ */
  65.